import { createRouter, createWebHashHistory } from 'vue-router'
import routes from './routes'
// import {useFlags} from "@/store/flags";
// import pinia from "@/store/sotre";
// import {parsePathQuery} from "@/utils";

const router = createRouter({
  history: createWebHashHistory(),
  routes: routes,
  scrollBehavior: () => ({ top: 0 })
})

router.beforeEach((to, from, next) => {
  const count = to.query.count
  /* if(!count) {
    next({
      ...to,
      query: {
        ...to.query,
        count: 1,
      }
    })
  } else { */
  /* if(+count > flags.maxCount) {
      flags.maxCount = +count
    } */
  next()
  // }
})

export default router
